<template>
    <rx-dialog @handOk="handleSubmit" @cancel="cancel">
        <rx-layout>
            <div slot="center" style>
                <rx-fit>
                    <div slot="toolheader" foldheader="true" foldbtn="false" border="false">
                        <div class="table-page-search-wrapper">
                            <a-form layout="inline">
                                <a-row :gutter="24">
                                    <a-col :span="8">
                                        <a-form-item :label="i18n('form.name','名称')">
                                            <a-input :placeholder="i18n('form.name','名称','input')" v-model="queryParam.Q_NAME__S_LK"/>
                                        </a-form-item>
                                    </a-col>
                                    <a-col :md="8" :sm="24">
                                  <span class="table-page-search-submitButtons">
                                    <a-button @click="$refs.table.loadData()" icon="search" type="primary">{{$ti18('rxList.searchBtn','查询')}}</a-button>
                                    <a-button @click="resetSearch" style="margin-left: 4px">{{$ti18('rxList.resetBtn','重置')}}</a-button>
                                  </span>
                                    </a-col>
                                </a-row>
                            </a-form>
                        </div>
                    </div>
                    <rx-grid
                        ref="table"
                        :allowRowSelect="true"
                        :multiSelect="false"
                        :columns="columns"
                        :defaultPageSize="10"
                        url="/api-portal/portal/core/customPageColumn/query"
                        :queryParam="queryParam"
                        data-field="result.data"
                        :pageSizeOptions="['10','30','40']"
                        id-field="id"
                        @selectChange="onSelectChange"
                    >
                    </rx-grid>
                </rx-fit>
            </div>
        </rx-layout>
    </rx-dialog>
</template>

<script>
import CustomPageTemplateApi from '@/api/portal/core/customPageTemplate'
import CustomPageTemplateEdit from './CustomPageTemplateEdit'
import {BaseList, RxFit, RxGrid, RxDialog, Util} from "@lowcode/jpaas-common-lib";

export default {
    name: 'CustomPageColumnDialog',
    mixins: [BaseList],
    props:["layerid","destroy"],
    components: {
        RxDialog,
        RxFit
    },
    data() {
        return {
            columns: [
                {
                    title: this.$ti18('rxList.index','序号'),
                    type: 'indexColumn',
                    width: 100,
                    dataIndex: 'serial',
                    scopedSlots: {customRender: 'serial'}
                },
                {title: this.i18n('form.name','名称'), dataIndex: 'name', width: 100},
                {title: this.i18n('form.key','别名'), dataIndex: 'alias', width: 100},
                {title: this.$ti18('rxForm.createBy','创建人'), dataIndex: 'createByName', width: 100},
            ],
        }
    },
    methods: {
        i18n(name,text,key){
            return this.$ti18(name,text,"insPortalDef",key);
        },
        getListByParams(parameter) {
            return CustomPageTemplateApi.query(parameter)
        },
        handleSubmit() {
            var obj=this.$refs.table.getSelectedRow();
            if(!obj){
                this.$message.error(this.i18n('msa.selectColumnTips','至少选择一项栏目！'));
                return;
            }
            Util.closeWindow(this, "ok",obj);
        },
        cancel(){
            Util.closeWindow(this,'cancel');
        },
    }
}
</script>
<style scoped>

</style>

